import { createApp } from 'vue'
import App from './App.vue'
import router from './router/index.js'
// import Tools from './util/tools'
// Tools({Vue, headerConfig})
import { ElMessage } from 'element-plus'

import apiFetch from './api/apiFetch.js'


const app = createApp(App)
// app.provide('apiFetch')

// console.log(apiFetch)
app.config.globalProperties.$apiFetch = apiFetch
// app.config.globalProperties.$http = '() => {}'

// 全局过滤器
app.config.globalProperties.$filters = {
  prefix(url: string) {
    if (url && url.startsWith('http')) {
      return url
    } else {
      url = `http://www.baidu.com/${url}`
      return url
    }
  }
}
//   console.log(app.config.globalProperties)
//   console.log(this.$filters)
app.use(apiFetch)
app.use(router)
app.mount('#app')
